# 3.try :
#   statesment\\正常代码
#   ....
#   except:
#   statesment\\出现异常就会执行这些语句
#   ....
#   else:
#   statesment\\没有异常抛出的时候一定执行
#   ....
import sys

for arg in sys.argv[1:]:
    try:
        f=open(arg,'r')
    except OSError:
        print('cannot open',arg)
    else:
        print(arg,'has',len(f.readline()),'line')
        f.close()